<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 
  <meta name="format-detection" content="telephone=no">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/index.css">
  <script type="text/javascript" src="__PUBLIC__/js/jquery-1.11.3.min.js"></script>
</script> 
  <title>宠物防丢器--添加信息</title>
</head>
<body>
<div class="addinfo_all">
  <div class="addinfo_top">
    <img src="__PUBLIC__/img/logo.png" width="40px" /><div class="fontinfo_add">信息添加</div>
  </div>
  <div class="info_gn_add">
    <div class="info_left">宠物名字:</div><div class="info_right"><input type="text" value="{$info.petname}" class="petname" placeholder="宠物の名字" /></div>
  </div>

  <div class="clear"></div>

  <div class="info_gn_add">
    <div class="info_left">宠物年龄:</div><div class="info_right">
    <select name="year" id="year" class="gn_add">
      <option value="0" <if condition="$info.ye eq 0">selected="selected"</if> >年龄</option>
      <option value="0" <if condition="$info.ye eq 0">selected="selected"</if>>0年</option>
      <option value="1" <if condition="$info.ye eq 1">selected="selected"</if>>1年</option>
      <option value="2" <if condition="$info.ye eq 2">selected="selected"</if>>2年</option>
      <option value="3" <if condition="$info.ye eq 3">selected="selected"</if>>3年</option>
      <option value="4" <if condition="$info.ye eq 4">selected="selected"</if>>4年</option>
      <option value="5" <if condition="$info.ye eq 5">selected="selected"</if>>5年</option>
      <option value="6" <if condition="$info.ye eq 6">selected="selected"</if>>6年</option>
      <option value="7" <if condition="$info.ye eq 7">selected="selected"</if>>7年</option>
      <option value="8" <if condition="$info.ye eq 8">selected="selected"</if>>8年</option>
      <option value="9" <if condition="$info.ye eq 9">selected="selected"</if>>9年</option>
      <option value="10" <if condition="$info.ye eq 10">selected="selected"</if>>10年</option>
      <option value="11" <if condition="$info.ye eq 11">selected="selected"</if>>11年</option>
      <option value="12" <if condition="$info.ye eq 12">selected="selected"</if>>12年</option>
      <option value="13" <if condition="$info.ye eq 13">selected="selected"</if>>13年</option>
      <option value="14" <if condition="$info.ye eq 14">selected="selected"</if>>14年</option>
      <option value="15" <if condition="$info.ye eq 15">selected="selected"</if>>15年</option>
      <option value="16" <if condition="$info.ye eq 16">selected="selected"</if>>16年</option>
      <option value="17" <if condition="$info.ye eq 17">selected="selected"</if>>17年</option>
      <option value="18" <if condition="$info.ye eq 18">selected="selected"</if>>18年</option>

    </select>
    零
    <select name="mous" id="mous" class="gn_add">
      <option value="0" <if condition="$info.mo eq 0">selected="selected"</if>>月龄</option>
      <option value="0" <if condition="$info.mo eq 0">selected="selected"</if>>0个月</option>
      <option value="1" <if condition="$info.mo eq 1">selected="selected"</if>>1个月</option>
      <option value="2" <if condition="$info.mo eq 2">selected="selected"</if>>2个月</option>
      <option value="3" <if condition="$info.mo eq 3">selected="selected"</if>>3个月</option>
      <option value="4" <if condition="$info.mo eq 4">selected="selected"</if>>4个月</option>
      <option value="5" <if condition="$info.mo eq 5">selected="selected"</if>>5个月</option>
      <option value="6" <if condition="$info.mo eq 6">selected="selected"</if>>6个月</option>
      <option value="7" <if condition="$info.mo eq 7">selected="selected"</if>>7个月</option>
      <option value="8" <if condition="$info.mo eq 8">selected="selected"</if>>8个月</option>
      <option value="9" <if condition="$info.mo eq 9">selected="selected"</if>>9个月</option>
      <option value="10" <if condition="$info.mo eq 10">selected="selected"</if>>10个月</option>
      <option value="11" <if condition="$info.mo eq 11">selected="selected"</if>>11个月</option>
      <option value="12" <if condition="$info.mo eq 12">selected="selected"</if>>12个月</option>
    </select>
    零
    <select name="day" id="day" class="gn_add">
      <option value="0" <if condition="$info.da eq 0">selected="selected"</if>>日龄</option>
      <option value="1" <if condition="$info.da eq 1">selected="selected"</if>>1天</option>
      <option value="2" <if condition="$info.da eq 2">selected="selected"</if>>2天</option>
      <option value="3" <if condition="$info.da eq 3">selected="selected"</if>>3天</option>
      <option value="4" <if condition="$info.da eq 4">selected="selected"</if>>4天</option>
      <option value="5" <if condition="$info.da eq 5">selected="selected"</if>>5天</option>
      <option value="6" <if condition="$info.da eq 6">selected="selected"</if>>6天</option>
      <option value="7" <if condition="$info.da eq 7">selected="selected"</if>>7天</option>
      <option value="8" <if condition="$info.da eq 8">selected="selected"</if>>8天</option>
      <option value="9" <if condition="$info.da eq 9">selected="selected"</if>>9天</option>
      <option value="10" <if condition="$info.da eq 10">selected="selected"</if>>10天</option>
      <option value="11" <if condition="$info.da eq 11">selected="selected"</if>>11天</option>
      <option value="12" <if condition="$info.da eq 12">selected="selected"</if>>12天</option>
      <option value="13" <if condition="$info.da eq 13">selected="selected"</if>>13天</option>
      <option value="14" <if condition="$info.da eq 14">selected="selected"</if>>14天</option>
      <option value="15" <if condition="$info.da eq 15">selected="selected"</if>>15天</option>
      <option value="16" <if condition="$info.da eq 16">selected="selected"</if>>16天</option>
      <option value="17" <if condition="$info.da eq 17">selected="selected"</if>>17天</option>
      <option value="18" <if condition="$info.da eq 18">selected="selected"</if>>18天</option>
      <option value="19" <if condition="$info.da eq 19">selected="selected"</if>>19天</option>
      <option value="20" <if condition="$info.da eq 20">selected="selected"</if>>20天</option>
      <option value="21" <if condition="$info.da eq 21">selected="selected"</if>>21天</option>
      <option value="22" <if condition="$info.da eq 22">selected="selected"</if>>22天</option>
      <option value="23" <if condition="$info.da eq 23">selected="selected"</if>>23天</option>
      <option value="24" <if condition="$info.da eq 24">selected="selected"</if>>24天</option>
      <option value="25" <if condition="$info.da eq 25">selected="selected"</if>>25天</option>
      <option value="26" <if condition="$info.da eq 26">selected="selected"</if>>26天</option>
      <option value="27" <if condition="$info.da eq 27">selected="selected"</if>>27天</option>
      <option value="28" <if condition="$info.da eq 28">selected="selected"</if>>28天</option>
      <option value="29" <if condition="$info.da eq 29">selected="selected"</if>>29天</option>
      <option value="30" <if condition="$info.da eq 30">selected="selected"</if>>30天</option>
      <option value="31" <if condition="$info.da eq 31">selected="selected"</if>>31天</option>
    </select></div>
  </div>
<div class="clear"></div>
<div class="info_gn_add">
    <div class="info_left">宠物类型:</div>
    <div class="info_right">
      <select class="petclass">
        <option value="0" <if condition="$info.pettype eq 0">selected="selected"</if>>选择宠物种类</option>
        <option value="1" <if condition="$info.pettype eq 1">selected="selected"</if>>狗狗</option>
        <option value="2" <if condition="$info.pettype eq 2">selected="selected"</if>>猫咪</option>
        <option value="3" <if condition="$info.pettype eq 3">selected="selected"</if>>兔子</option>
        <option value="4" <if condition="$info.pettype eq 4">selected="selected"</if>>老鼠</option>
        <option value="5" <if condition="$info.pettype eq 5">selected="selected"</if>>其他</option>
      </select>
    </div>
  </div>
<select class="month type-link value_info  anmimo-type2" >
<option value="0">选择宠物类型</option>
<volist name="petclassinfo" id="vo">11
<option value="{$vo.p_t_id}" <if condition="$info.petclass eq $vo['p_t_id']">selected="selected"</if>>{$vo.p_t_name}</option>
</volist>
</select>
  <div class="clear"></div>

<div class=" info_left_new">
    <div class="info_left ">主人电话:</div><div class="info_right"><input value="{$info.tel}" type="text" placeholder="主人の电话" class="tel"/></div>
  </div>
  <br/><br/>
  <div class=" info_left_new">
    <div class="info_left">主人QQ:</div><div class="info_right"><input type="text" value="{$info.qq}" placeholder="主人のQQ" class="qq"/></div>
  </div>
  <br/><br/>
 <div class=" info_left_new">
    <div class="info_left">主人微信:</div><div class="info_right"><input type="text" value="{$info.wx}" placeholder="主人の微信" class="wx"/></div>
  </div>
  <br/><br/>
  <div class="clear"></div>
 <!--  <div class="info_left_new">
    <div class="info_left">宠物店名:</div><div class="info_right"><input type="text" value="{$info.shopname}" placeholder="哪个宠物店购买" class="shop_name"/></div>
  </div> -->
  
    <div class="clear"></div>
  <div class="submit">提交修改</div>

</div>

<script type="text/javascript">
  //选择宠物的种类之后
            $('.anmimo-type2').show();
            $('.petclass').change(function(){
            $('.anmimo-type2').show();
            var val=$(this).find('option:selected').val();
            $.getJSON("/Public/json/petclass.json",function(data){  
            var strHtmlC = "";//存储数据的变量   
            strHtmlC+='<option value="">'+'选择宠物类型'+'</option>';
            $.each(data,function(infoIndex,info){
              if(info['p_t_status']==val){
                strHtmlC+='<option value="'+info['p_t_id']+'">'+info['p_t_name']+'</option>';
              }
            }) 
            $('.anmimo-type2').empty();
            $('.anmimo-type2').append(strHtmlC);
            $('.anmimo-type2').attr('disabled',false);
            $('.anmimo-type2').css('background-color','#FFFFFF');
            })
          })
</script>

<script>
  $('.submit').one('click',function(){
  var petname=$('.info_right input').val();
  var ye=$('#year').val();
  var mo=$('#mous').val();
  var da=$('#day').val();
  var pettype=$('.petclass').val();
  var petclass=$('.value_info').val();
  var tel=$('.tel').val();
  var qq=$('.qq').val();
  var wx=$('.wx').val();
  var shopname=$('.shop_name').val();
  var key=$('.key').val();
  var password=$('.password').val();
   

var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
if(!myreg.test($(".tel").val())) 
{ 
    alert('请输入有效的手机号码！'); 
    return false; 
}
  $.post("{:U('Index/in_gongnengadd')}",{save:1,petname:petname,ye:ye,mo:mo,da:da,pettype:pettype,petclass:petclass,tel:tel,qq:qq,wx:wx,shopname:shopname,key:key,password:password},function(data){
    if(data.status==100){
      var val=data.info;
      alert('修改成功,将要跳转到首页');
      location.href="{:U('Index/index')}";
    }else{
      alert('修改失败');
    }
  })
  })

</script>
</body>
</html>